// 平均速度
(function () {
  var ydata = [
    [
      20, 20, 19, 19, 18, 18, 17, 16, 15, 14, 14, 13, 12, 11, 10, 9, 9, 8, 7, 7,
      6, 6, 6, 5, 5, 5, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
      3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1,
      1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1,
      1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 2, 2, 2, 2, 2,
      2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1,
      1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
      2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3,
      3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
      1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
      2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
      2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2,
      2, 2, 2, 2, 2,
    ],
    [
      20, 20, 19, 18, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 7, 6, 6, 5,
      5, 5, 4, 4, 4, 4, 4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2,
      2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
      2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
      2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
      1, 1, 2, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
      2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
      2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
      1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
      1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
      2, 2, 2, 2,
    ],
    [
      20, 19, 19, 18, 18, 17, 17, 15, 14, 13, 12, 10, 9, 7, 6, 6, 6, 6, 6, 6, 6,
      6, 6, 6, 7, 7, 7, 6, 6, 8, 7, 7, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10,
      10, 10, 10, 10, 10, 9, 9, 9, 9, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 11,
      10, 10, 10, 10, 10, 9, 11, 10, 10, 10, 11, 10, 11, 11, 10, 11, 11, 10, 10,
      10, 11, 11, 11, 11, 11, 11, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8,
      8, 8, 8, 8, 8, 8, 8, 8, 9, 10, 9, 10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 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 2, 2, 2, 2, 2, 1, 1, 2,
      2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 3, 2, 2,
    ],
  ];
  var allSeries = [
    {
      name: "安全距离",
      type: "line",
      smooth: true,
      data: ydata[0],
    },
    {
      name: "智能驾驶员",
      type: "line",
      smooth: true,
      data: ydata[1],
    },
    {
      name: "静态",
      type: "line",
      smooth: true,
      data: ydata[2],
    },
    {
      name: "动态",
      type: "line",
      smooth: true,
      data: ydata[3],
    },
    {
      name: "低强度",
      type: "line",
      smooth: true,
      data: ydata[4],
    },
    {
      name: "高强度",
      type: "line",
      smooth: true,
      data: ydata[5],
    },
    {
      name: "circle交叉口",
      type: "line",
      smooth: true,
      data: ydata[6],
    },
    {
      name: "cross交叉口",
      type: "line",
      smooth: true,
      data: ydata[7],
    },
    {
      name: "t交叉口",
      type: "line",
      smooth: true,
      data: ydata[8],
    },
  ];
  // 1. 实例化对象
  var myChart = echarts.init(document.querySelector(".bar1 .chart"));
  // 2.指定配置
  var option = {
    // 通过这个color修改两条线的颜色
    color: ["#ed3f35", "#1089E7", "#F57474", "#56D0E3", "#F8B448", "#8B78F6"],
    tooltip: {
      trigger: "axis",
    },
    legend: {
      // type: 'legendUnSelect',
      // 如果series 对象有name 值，则 legend可以不用写data
      // 修改图例组件 文字颜色
      textStyle: {
        color: "#4c9bfd",
      },
      // 这个10% 必须加引号
      right: "10%",
    },
    grid: {
      top: "20%",
      left: "3%",
      right: "4%",
      bottom: "3%",
      show: true, // 显示边框
      borderColor: "#012f4a", // 边框颜色
      containLabel: true, // 包含刻度文字在内
    },
    xAxis: {
      type: "category",
      boundaryGap: false,
      data: [
        0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
        20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
        38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
        56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73,
        74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
        92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107,
        108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
        122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135,
        136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
        150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163,
        164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177,
        178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
        192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205,
        206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219,
        220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233,
        234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247,
        248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261,
        262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275,
        276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289,
        290, 291, 292, 293, 294, 295, 296, 297, 298, 299,
      ],
      axisTick: {
        show: false, // 去除刻度线
      },
      axisLabel: {
        color: "#4c9bfd", // 文本颜色
      },
      axisLine: {
        show: false, // 去除轴线
      },
    },
    yAxis: {
      type: "value",
      axisTick: {
        show: false, // 去除刻度线
      },
      axisLabel: {
        color: "#4c9bfd", // 文本颜色
      },
      axisLine: {
        show: false, // 去除轴线
      },
      splitLine: {
        lineStyle: {
          color: "#012f4a", // 分割线颜色
        },
      },
    },
    series: [],
  };

  // 3. 把配置给实例对象
  myChart.setOption(option);
  // 4. 让图表跟随屏幕自动的去适应
  window.addEventListener("resize", function () {
    myChart.resize();
  });
  // 5.点击切换效果
  $(".bar1 h2").on("click", "a", function () {
    // alert(1);
    this.style.color = "#ff4d4d";
    option.series.length = 0;
    console.log(option.series);
    console.log($(this).index());
    // 点击 a 之后 根据当前a的索引号 找到对应的 yearData的相关对象
    // console.log(yearData[$(this).index()]);
    // var obj = yearData[$(this).index()];
    if ($(this).index() == 3) {
      option.series.push(allSeries[$(this).index() * 2]);
      option.series.push(allSeries[$(this).index() * 2 + 1]);
      option.series.push(allSeries[$(this).index() * 2 + 2]);
    } else {
      option.series.push(allSeries[$(this).index() * 2]);
      option.series.push(allSeries[$(this).index() * 2 + 1]);
      option.series[2] = allSeries[$(this).index() * 2 + 1];
    }

    // 需要重新渲染
    myChart.setOption(option);
  });
  $("h2").on("blur", "a", function () {
    this.style.color = "#ffffff";
  });
})();

//等待时间
(function () {
  var ydata = [
    [
      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 10, 18, 29, 47, 67, 96, 128,
      168, 190, 233, 292, 341, 413, 485, 574, 660, 755, 851, 920, 1003, 1090,
      1203, 1283, 1391, 1498, 1643, 1759, 1863, 1952, 2050, 2193, 2350, 2472,
      2575, 2641, 2732, 2752, 2824, 2938, 3037, 3107, 3234, 3384, 3455, 3419,
      3363, 3431, 3535, 3671, 3788, 3897, 3911, 3896, 3897, 3932, 4030, 4056,
      4055, 4079, 4084, 4075, 3966, 3952, 4073, 4175, 4231, 4270, 4398, 4339,
      4487, 4600, 4779, 4893, 4939, 5030, 5160, 5370, 5559, 5649, 5900, 6164,
      6379, 6455, 6571, 6599, 6780, 6998, 7152, 7309, 7581, 7813, 8065, 8162,
      8277, 8302, 8308, 8332, 8387, 8337, 8377, 8165, 8019, 7934, 7828, 7798,
      7845, 7956, 8118, 8130, 8103, 8120, 8096, 8129, 8163, 8261, 8120, 7914,
      7665, 7648, 7402, 7413, 7539, 7527, 7599, 7387, 7205, 7000, 6996, 6856,
      6763, 6584, 6398, 6333, 6293, 6318, 6370, 6172, 6111, 6069, 5973, 6006,
      6102, 6256, 6504, 6544, 6619, 6695, 6857, 6983, 7047, 7218, 7438, 7652,
      7637, 7842, 8057, 8334, 8482, 8644, 8699, 8776, 8911, 8900, 8813, 8737,
      8763, 8871, 9033, 8904, 8722, 8560, 7818, 7646, 7609, 7725, 7783, 7758,
      7802, 7765, 7744, 7714, 7660, 7735, 7718, 7648, 7566, 7542, 7571, 7625,
      7773, 7710, 7723, 7739, 7717, 7726, 7824, 7610, 7587, 7490, 7387, 7323,
      7234, 7312, 7237, 7249, 7244, 6869, 6412, 6069, 5818, 5519, 4961, 4637,
      4535, 4469, 4407, 4428, 4437, 4435, 4527, 4612, 4654, 4710, 4808, 4878,
      4960, 5060, 5216, 5408, 5584, 5782, 5987, 5960, 6019, 5939, 5907, 5945,
      5997, 6037, 6041, 6152, 6225, 6375, 6504, 6497, 6501, 6512, 6580, 6677,
      6809, 6969, 7057, 7182, 7185, 7234, 7315, 7472, 7522, 7739, 7832, 7951,
      8073, 8278, 8402, 8402, 8398, 8277, 8192, 8123, 7880, 7771, 7562, 7456,
      7279, 7112, 7019, 6967, 6838, 6786, 6775, 6895, 6992, 7083, 7195, 7330,
      7541,
    ],
    [
      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 4, 8, 16, 26, 41, 57, 75, 99, 118,
      133, 165, 189, 227, 259, 288, 326, 360, 409, 466, 510, 540, 555, 598, 596,
      597, 616, 643, 674, 695, 749, 819, 892, 980, 1049, 1120, 1210, 1288, 1380,
      1489, 1596, 1677, 1708, 1786, 1865, 1873, 1944, 2035, 2120, 2236, 2256,
      2318, 2425, 2558, 2711, 2870, 3046, 3225, 3237, 3206, 3181, 3199, 3185,
      2982, 2977, 2985, 2976, 2963, 2979, 3007, 3039, 3146, 3183, 3228, 3320,
      3469, 3588, 3719, 3818, 3942, 4018, 4092, 4234, 4409, 4435, 4519, 4622,
      4763, 4882, 4999, 5119, 5303, 5501, 5673, 5751, 5853, 5684, 5676, 5736,
      5778, 5844, 5609, 5528, 5630, 5663, 5730, 5786, 5119, 5303, 5414, 5493,
      5596, 5781, 5928, 6110, 6238, 6331, 6321, 6404, 6435, 6510, 6663, 6728,
      6803, 6937, 7114, 7226, 6902, 6519, 6104, 5858, 5662, 5581, 5437, 5248,
      5186, 5216, 5109, 4852, 4574, 4458, 4392, 4486, 4405, 4343, 4278, 4223,
      4225, 4272, 4275, 4303, 4310, 4200, 4280, 4317, 4452, 4520, 4579, 4786,
      4724, 4730, 4653, 4695, 4907, 4922, 4981, 5026, 5180, 5301, 5309, 5226,
      5159, 5217, 5173, 5046, 5080, 4990, 5009, 5096, 5095, 5277, 5362, 5397,
      5485, 5712, 5694, 5681, 5715, 5729, 5876, 5935, 6061, 6074, 6058, 6014,
      6116, 6176, 6235, 5973, 5902, 5855, 5929, 5999, 5959, 5985, 6097, 6161,
      6230, 6259, 6424, 6542, 6523, 6601, 6300, 6077, 5968, 5919, 6034, 5962,
      5899, 6025, 6069, 6121, 6249, 6297, 6373, 6452, 6463, 6477, 6653, 6721,
      6911, 6991, 7154, 6975, 6692, 6404, 6449, 6408, 6500, 6157, 5899, 5806,
      5809, 5838, 5879, 5859, 5771, 5607, 5628, 5522, 5587, 5574, 5742, 5858,
      5883, 5948, 5970, 6082, 6197, 6183, 6231, 6301, 6478, 6619, 6678, 6792,
      6918, 6609, 6388, 6378, 6289, 6139, 6116, 6262, 6167, 5978, 5962, 6009,
      6119, 6109, 6166, 6229, 6206, 6332, 6357, 6415, 6432,
    ],

    [
      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 4, 8, 16, 26, 41, 57, 75, 99, 118,
      133, 165, 189, 227, 259, 288, 326, 360, 409, 466, 510, 540, 555, 598, 596,
      597, 616, 643, 674, 695, 749, 819, 892, 980, 1049, 1120, 1210, 1288, 1380,
      1489, 1596, 1677, 1708, 1786, 1865, 1873, 1944, 2035, 2120, 2236, 2256,
      2318, 2425, 2558, 2711, 2870, 3046, 3225, 3237, 3206, 3181, 3199, 3185,
      2982, 2977, 2985, 2976, 2963, 2979, 3007, 3039, 3146, 3183, 3228, 3320,
      3469, 3588, 3719, 3818, 3942, 4018, 4092, 4234, 4409, 4435, 4519, 4622,
      4763, 4882, 4999, 5119, 5303, 5501, 5673, 5751, 5853, 5684, 5676, 5736,
      5778, 5844, 5609, 5528, 5630, 5663, 5730, 5786, 5119, 5303, 5414, 5493,
      5596, 5781, 5928, 6110, 6238, 6331, 6321, 6404, 6435, 6510, 6663, 6728,
      6803, 6937, 7114, 7226, 6902, 6519, 6104, 5858, 5662, 5581, 5437, 5248,
      5186, 5216, 5109, 4852, 4574, 4458, 4392, 4486, 4405, 4343, 4278, 4223,
      4225, 4272, 4275, 4303, 4310, 4200, 4280, 4317, 4452, 4520, 4579, 4786,
      4724, 4730, 4653, 4695, 4907, 4922, 4981, 5026, 5180, 5301, 5309, 5226,
      5159, 5217, 5173, 5046, 5080, 4990, 5009, 5096, 5095, 5277, 5362, 5397,
      5485, 5712, 5694, 5681, 5715, 5729, 5876, 5935, 6061, 6074, 6058, 6014,
      6116, 6176, 6235, 5973, 5902, 5855, 5929, 5999, 5959, 5985, 6097, 6161,
      6230, 6259, 6424, 6542, 6523, 6601, 6300, 6077, 5968, 5919, 6034, 5962,
      5899, 6025, 6069, 6121, 6249, 6297, 6373, 6452, 6463, 6477, 6653, 6721,
      6911, 6991, 7154, 6975, 6692, 6404, 6449, 6408, 6500, 6157, 5899, 5806,
      5809, 5838, 5879, 5859, 5771, 5607, 5628, 5522, 5587, 5574, 5742, 5858,
      5883, 5948, 5970, 6082, 6197, 6183, 6231, 6301, 6478, 6619, 6678, 6792,
      6918, 6609, 6388, 6378, 6289, 6139, 6116, 6262, 6167, 5978, 5962, 6009,
      6119, 6109, 6166, 6229, 6206, 6332, 6357, 6415, 6432,
    ],
    [
      0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 7, 14, 21, 28, 38, 54, 73, 92, 118, 143,
      172, 207, 244, 288, 333, 366, 402, 449, 501, 559, 604, 647, 702, 737, 803,
      874, 938, 963, 1018, 1105, 1192, 1229, 1288, 1358, 1428, 1536, 1616, 1709,
      1816, 1907, 2006, 2130, 2239, 2354, 2473, 2574, 2638, 2744, 2701, 2678,
      2650, 2720, 2740, 2839, 2983, 3122, 3196, 3280, 3272, 3309, 3485, 3562,
      3636, 3660, 3735, 3798, 3938, 4002, 4162, 4289, 4476, 4662, 4847, 5021,
      5186, 5349, 5540, 5730, 5938, 6142, 6360, 6527, 6754, 6954, 7195, 7359,
      7575, 7766, 8002, 8255, 8497, 8741, 8684, 8687, 8640, 8782, 8723, 8570,
      8165, 8093, 8092, 7906, 7265, 6939, 6830, 6710, 6862, 6898, 6962, 7158,
      7279, 7432, 7618, 7751, 7727, 7714, 7903, 8017, 8096, 7929, 7868, 7827,
      7858, 7972, 8015, 7675, 7678, 7636, 7622, 7708, 7824, 7877, 7897, 8126,
      8279, 8470, 8579, 8770, 8742, 8775, 8710, 8878, 9040, 9187, 9308, 9520,
      9523, 9417, 9276, 9273, 9351, 9531, 9545, 9701, 9566, 9456, 9303, 9291,
      9339, 9372, 9325, 9515, 9457, 9435, 9536, 9612, 9764, 9947, 10032, 10213,
      10399, 10444, 10607, 10521, 10634, 10632, 10713, 10733, 10904, 10955,
      10984, 11072, 11185, 11314, 11386, 11619, 11617, 11809, 11878, 11977,
      12193, 12379, 12394, 12288, 12338, 12415, 12588, 12678, 12847, 13059,
      13024, 12792, 12833, 12894, 13155, 13093, 13020, 13084, 13033, 13301,
      13180, 13374, 13360, 13452, 13324, 13273, 13387, 13588, 13339, 13021,
      13045, 13184, 13105, 12979, 12934, 12884, 12728, 11991, 11506, 11408,
      11226, 11160, 11349, 11441, 11464, 11650, 11707, 11731, 11761, 11887,
      12093, 12251, 12328, 12502, 12656, 12791, 12355, 11881, 11385, 11276,
      10963, 10669, 10638, 10458, 10092, 9586, 8940, 8473, 8222, 8101, 7962,
      7925, 8040, 8076, 8209, 8178, 8316, 8478, 8330, 8227, 8194, 8170, 8238,
      8297, 8230, 8294, 8445, 8566, 8699, 8822, 9003, 9156, 9345, 9568, 9809,
      10036, 10269, 10507, 10571, 10751,
    ],
    [
      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 7, 11, 19, 27, 37, 49, 61, 75, 80,
      83, 98, 113, 128, 143, 158, 174, 188, 203, 218, 233, 212, 196, 193, 156,
      145, 134, 124, 130, 136, 142, 148, 154, 160, 166, 172, 178, 184, 191, 198,
      206, 214, 168, 175, 183, 102, 68, 74, 80, 88, 48, 45, 44, 49, 54, 59, 64,
      69, 51, 58, 65, 74, 83, 72, 79, 86, 88, 95, 102, 110, 116, 124, 133, 142,
      151, 161, 171, 181, 191, 203, 174, 175, 185, 195, 144, 153, 163, 173, 183,
      194, 207, 220, 231, 245, 187, 198, 171, 175, 184, 193, 202, 211, 221, 229,
      240, 249, 260, 271, 282, 293, 304, 315, 327, 339, 352, 277, 233, 166, 138,
      150, 133, 137, 148, 161, 174, 188, 182, 194, 120, 131, 142, 153, 164, 175,
      187, 199, 213, 227, 152, 163, 175, 187, 199, 211, 223, 235, 247, 259, 271,
      284, 271, 285, 299, 314, 330, 347, 364, 381, 398, 318, 299, 315, 331, 348,
      277, 286, 300, 314, 328, 342, 357, 294, 274, 286, 299, 312, 325, 340, 355,
      371, 388, 405, 422, 441, 461, 403, 369, 335, 302, 319, 285, 259, 217, 212,
      224, 237, 236, 247, 146, 156, 167, 179, 192, 205, 218, 232, 246, 262, 278,
      291, 308, 326, 346, 196, 211, 226, 242, 258, 274, 291, 275, 291, 307, 323,
      339, 356, 374, 392, 411, 430, 449, 468, 487, 506, 344, 360, 377, 395, 415,
      436, 457, 479, 501, 523, 545, 568, 545, 538, 544, 565, 588, 612, 636, 661,
      686, 602, 566, 589, 612, 635, 562, 528, 497, 465, 486, 455, 425, 377, 210,
      157, 154, 166, 178, 191, 204, 218, 232, 246, 261, 278, 295, 313, 331, 349,
      368, 388, 410, 430,
    ],
    [
      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 4, 8, 16, 26, 41, 57, 75, 99, 118,
      133, 165, 189, 227, 259, 288, 326, 360, 409, 466, 510, 540, 555, 598, 596,
      597, 616, 643, 674, 695, 749, 819, 892, 980, 1049, 1120, 1210, 1288, 1380,
      1489, 1596, 1677, 1708, 1786, 1865, 1873, 1944, 2035, 2120, 2236, 2256,
      2318, 2425, 2558, 2711, 2870, 3046, 3225, 3237, 3206, 3181, 3199, 3185,
      2982, 2977, 2985, 2976, 2963, 2979, 3007, 3039, 3146, 3183, 3228, 3320,
      3469, 3588, 3719, 3818, 3942, 4018, 4092, 4234, 4409, 4435, 4519, 4622,
      4763, 4882, 4999, 5119, 5303, 5501, 5673, 5751, 5853, 5684, 5676, 5736,
      5778, 5844, 5609, 5528, 5630, 5663, 5730, 5786, 5119, 5303, 5414, 5493,
      5596, 5781, 5928, 6110, 6238, 6331, 6321, 6404, 6435, 6510, 6663, 6728,
      6803, 6937, 7114, 7226, 6902, 6519, 6104, 5858, 5662, 5581, 5437, 5248,
      5186, 5216, 5109, 4852, 4574, 4458, 4392, 4486, 4405, 4343, 4278, 4223,
      4225, 4272, 4275, 4303, 4310, 4200, 4280, 4317, 4452, 4520, 4579, 4786,
      4724, 4730, 4653, 4695, 4907, 4922, 4981, 5026, 5180, 5301, 5309, 5226,
      5159, 5217, 5173, 5046, 5080, 4990, 5009, 5096, 5095, 5277, 5362, 5397,
      5485, 5712, 5694, 5681, 5715, 5729, 5876, 5935, 6061, 6074, 6058, 6014,
      6116, 6176, 6235, 5973, 5902, 5855, 5929, 5999, 5959, 5985, 6097, 6161,
      6230, 6259, 6424, 6542, 6523, 6601, 6300, 6077, 5968, 5919, 6034, 5962,
      5899, 6025, 6069, 6121, 6249, 6297, 6373, 6452, 6463, 6477, 6653, 6721,
      6911, 6991, 7154, 6975, 6692, 6404, 6449, 6408, 6500, 6157, 5899, 5806,
      5809, 5838, 5879, 5859, 5771, 5607, 5628, 5522, 5587, 5574, 5742, 5858,
      5883, 5948, 5970, 6082, 6197, 6183, 6231, 6301, 6478, 6619, 6678, 6792,
      6918, 6609, 6388, 6378, 6289, 6139, 6116, 6262, 6167, 5978, 5962, 6009,
      6119, 6109, 6166, 6229, 6206, 6332, 6357, 6415, 6432,
    ],
    [
      0, 0, 0, 0, 0, 0, 0, 1, 2, 6, 11, 18, 27, 37, 48, 60, 75, 92, 109, 128,
      148, 168, 188, 209, 230, 251, 272, 293, 314, 335, 356, 377, 398, 419, 440,
      461, 482, 503, 524, 545, 566, 587, 608, 629, 650, 455, 269, 120, 30, 0, 0,
      0, 0, 1, 8, 16, 26, 37, 50, 68, 87, 109, 135, 163, 194, 226, 258, 295,
      333, 372, 411, 451, 492, 533, 575, 617, 660, 703, 746, 789, 832, 875, 918,
      961, 1004, 1047, 1090, 1133, 1176, 1219, 1113, 1010, 908, 840, 828, 815,
      804, 794, 820, 846, 826, 807, 792, 816, 840, 864, 877, 891, 904, 924, 945,
      966, 987, 1008, 1029, 1050, 1071, 1092, 1113, 1134, 1155, 1176, 1197,
      1218, 1239, 1260, 1281, 1302, 1323, 1344, 1365, 1386, 1407, 1428, 1449,
      1026, 611, 271, 65, 0, 0, 0, 1, 2, 5, 10, 19, 26, 40, 57, 77, 101, 127,
      156, 189, 223, 261, 300, 340, 381, 422, 464, 506, 548, 591, 634, 677, 720,
      763, 806, 849, 892, 935, 978, 1021, 1064, 1107, 1150, 1193, 1236, 1171,
      1105, 1038, 1005, 1037, 1069, 1101, 1133, 1165, 1197, 1229, 1261, 1293,
      1325, 1357, 1389, 1421, 1453, 1485, 1517, 1549, 1581, 1613, 1645, 1677,
      1709, 1741, 1773, 1805, 1837, 1869, 1901, 1933, 1965, 1997, 2029, 2061,
      2093, 2125, 2157, 2189, 2221, 2253, 2285, 2317, 2127, 1939, 1826, 1778,
      1801, 1824, 1847, 1870, 1894, 1918, 1944, 1973, 2002, 2032, 2063, 2095,
      2127, 2159, 2191, 2223, 2255, 2287, 2319, 2351, 2383, 2415, 2447, 2479,
      2511, 2543, 2575, 2607, 2639, 2671, 2703, 2735, 2767, 2799, 2831, 2863,
      2895, 2927, 2959, 2991, 3023, 2945, 2866, 2823, 2813, 2836, 2859, 2882,
      2905, 2928, 2951, 2974, 2997, 3020, 3043, 3066, 3089, 3112, 3135, 3158,
      3181, 3204, 3227, 3250, 3273, 3296, 3319, 3342, 3365, 3388, 3411,
    ],
    [
      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 8,
      13, 19, 26, 34, 42, 51, 61, 72, 83, 95, 109, 123, 138, 154, 171, 189, 209,
      230, 225, 234, 158, 96, 57, 26, 14, 17, 23, 30, 43, 57, 71, 89, 110, 133,
      157, 182, 209, 227, 252, 279, 306, 335, 365, 382, 412, 443, 477, 475, 500,
      527, 557, 593, 630, 668, 661, 645, 644, 643, 666, 695, 728, 763, 799, 838,
      840, 674, 523, 417, 327, 245, 187, 143, 147, 126, 130, 141, 161, 191, 222,
      256, 293, 332, 373, 417, 464, 514, 565, 618, 673, 729, 786, 844, 888, 930,
      986, 1043, 1103, 1163, 1225, 1290, 1356, 1422, 1451, 1509, 1569, 1633,
      1701, 1732, 1725, 1716, 1536, 1364, 1193, 963, 771, 630, 535, 453, 387,
      323, 277, 252, 252, 297, 321, 348, 384, 432, 487, 546, 609, 676, 746, 819,
      894, 972, 1052, 1134, 1218, 1304, 1364, 1426, 1490, 1555, 1618, 1683,
      1734, 1795, 1861, 1903, 1988, 2055, 2088, 2110, 2146, 2010, 1897, 1780,
      1665, 1556, 1450, 1350, 1361, 1269, 1212, 1154, 1074, 1013, 971, 920, 876,
      895, 912, 884, 933, 968, 999, 1046, 1104, 1179, 1264, 1354, 1453, 1550,
      1652, 1756, 1861, 1970, 2082, 2197, 2318, 2440, 2563, 2692, 2818, 2944,
      3073, 3163, 3214, 3271, 3140, 3011, 2880, 2752, 2627, 2509, 2374, 2245,
      2195, 2070, 1990, 1925, 1812, 1737, 1736, 1634, 1564, 1500, 1454, 1432,
      1378, 1346, 1359, 1357, 1328, 1314, 1352, 1355, 1439, 1550, 1666, 1785,
      1908, 2005, 2104, 2202, 2302, 2410, 2519, 2632, 2746, 2862, 2941, 3014,
      3115, 3019, 2921, 2826, 2755, 2658, 2605, 2509, 2411, 2369, 2272, 2330,
      2229, 2133, 2074, 1980, 1886, 1856, 1900, 1976, 2065, 2158, 2123, 2135,
      2146, 2160, 2155, 2115, 2098, 2142, 2234,
    ],
    [
      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 4, 7, 11, 15, 20, 25, 31, 37,
      43, 50, 58, 66, 76, 87, 99, 78, 61, 47, 36, 32, 30, 27, 25, 26, 26, 27,
      34, 36, 42, 49, 56, 63, 71, 80, 89, 99, 110, 121, 133, 145, 158, 172, 187,
      202, 218, 208, 200, 194, 193, 194, 198, 204, 212, 222, 234, 247, 263, 280,
      297, 315, 333, 353, 373, 393, 414, 435, 457, 479, 502, 526, 550, 575, 601,
      628, 658, 600, 551, 507, 466, 427, 397, 370, 345, 326, 304, 287, 305, 288,
      307, 327, 352, 381, 404, 423, 445, 471, 498, 517, 527, 532, 556, 581, 603,
      627, 653, 590, 531, 467, 407, 356, 304, 260, 214, 212, 197, 164, 168, 165,
      172, 144, 119, 131, 138, 156, 177, 198, 214, 225, 240, 260, 280, 301, 287,
      306, 328, 320, 316, 315, 316, 323, 331, 342, 354, 377, 394, 417, 441, 466,
      492, 519, 548, 577, 606, 636, 667, 698, 729, 761, 794, 827, 860, 893, 927,
      962, 997, 941, 890, 845, 802, 759, 719, 685, 662, 640, 620, 601, 596, 579,
      564, 591, 617, 644, 627, 617, 644, 672, 697, 725, 753, 781, 809, 837, 865,
      893, 921, 857, 793, 732, 672, 611, 550, 492, 433, 375, 319, 314, 225, 160,
      170, 181, 149, 118, 87, 97, 108, 120, 132, 144, 157, 171, 185, 200, 216,
      232, 249, 210, 177, 148, 124, 103, 87, 77, 70, 68, 83, 81, 84, 89, 102,
      118, 137, 157, 175, 196, 218, 242, 268, 294, 320, 348, 376, 405, 435, 466,
      498, 475, 455, 440, 427, 413, 407, 399, 395, 412, 437, 435, 433, 450, 470,
      491, 489, 512, 533, 558, 580, 605, 630, 655, 683, 711, 739, 767, 785, 807,
      832,
    ],
  ];
  var allSeries = [
    {
      name: "安全距离",
      type: "line",
      smooth: true,
      data: ydata[0],
    },
    {
      name: "智能驾驶员",
      type: "line",
      smooth: true,
      data: ydata[1],
    },
    {
      name: "静态",
      type: "line",
      smooth: true,
      data: ydata[2],
    },
    {
      name: "动态",
      type: "line",
      smooth: true,
      data: ydata[3],
    },
    {
      name: "低强度",
      type: "line",
      smooth: true,
      data: ydata[4],
    },
    {
      name: "高强度",
      type: "line",
      smooth: true,
      data: ydata[5],
    },
    {
      name: "circle交叉口",
      type: "line",
      smooth: true,
      data: ydata[6],
    },
    {
      name: "cross交叉口",
      type: "line",
      smooth: true,
      data: ydata[7],
    },
    {
      name: "t交叉口",
      type: "line",
      smooth: true,
      data: ydata[8],
    },
  ];
  // 1. 实例化对象
  var myChart = echarts.init(document.querySelector(".line1 .chart"));
  // 2.指定配置
  var option = {
    // 通过这个color修改两条线的颜色
    color: [
      "#00f2f1",
      "#ed3f35",
      "#1089E7",
      "#F57474",
      "#56D0E3",
      "#F8B448",
      "#8B78F6",
    ],
    tooltip: {
      trigger: "axis",
    },
    legend: {
      // 如果series 对象有name 值，则 legend可以不用写data
      // 修改图例组件 文字颜色
      textStyle: {
        color: "#4c9bfd",
      },
      // 这个10% 必须加引号
      right: "10%",
    },
    grid: {
      top: "20%",
      left: "3%",
      right: "4%",
      bottom: "3%",
      show: true, // 显示边框
      borderColor: "#012f4a", // 边框颜色
      containLabel: true, // 包含刻度文字在内
    },

    xAxis: {
      type: "category",
      boundaryGap: false,
      data: [
        0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
        20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
        38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
        56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73,
        74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
        92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107,
        108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
        122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135,
        136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
        150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163,
        164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177,
        178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
        192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205,
        206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219,
        220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233,
        234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247,
        248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261,
        262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275,
        276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289,
        290, 291, 292, 293, 294, 295, 296, 297, 298, 299,
      ],
      axisTick: {
        show: false, // 去除刻度线
      },
      axisLabel: {
        color: "#4c9bfd", // 文本颜色
      },
      axisLine: {
        show: false, // 去除轴线
      },
    },
    yAxis: {
      type: "value",
      axisTick: {
        show: false, // 去除刻度线
      },
      axisLabel: {
        color: "#4c9bfd", // 文本颜色
      },
      axisLine: {
        show: false, // 去除轴线
      },
      splitLine: {
        lineStyle: {
          color: "#012f4a", // 分割线颜色
        },
      },
    },
    series: [],
  };

  // 3. 把配置给实例对象
  myChart.setOption(option);
  // 4. 让图表跟随屏幕自动的去适应
  window.addEventListener("resize", function () {
    myChart.resize();
  });

  // 5.点击切换效果
  $(".line1 h2").on("click", "a", function () {
    this.style.color = "#ff4d4d";
    option.series.length = 0;
    console.log(option.series);
    console.log($(this).index());
    // 点击 a 之后 根据当前a的索引号 找到对应的 yearData的相关对象
    // console.log(yearData[$(this).index()]);
    // var obj = yearData[$(this).index()];
    if ($(this).index() == 3) {
      option.series.push(allSeries[$(this).index() * 2]);
      option.series.push(allSeries[$(this).index() * 2 + 1]);
      option.series.push(allSeries[$(this).index() * 2 + 2]);
    } else {
      option.series.push(allSeries[$(this).index() * 2]);
      option.series.push(allSeries[$(this).index() * 2 + 1]);
      option.series[2] = allSeries[$(this).index() * 2 + 1];
    }
    // 需要重新渲染
    myChart.setOption(option);
  });
})();

//排队长度
(function () {
  var ydata = [
    [
      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 10, 20, 40, 44, 54, 66, 76, 86,
      100, 106, 112, 114, 109, 104, 104, 118, 123, 134, 139, 139, 141, 126, 134,
      126, 111, 117, 122, 127, 128, 128, 140, 139, 127, 132, 134, 134, 127, 134,
      134, 139, 149, 156, 152, 160, 162, 166, 166, 148, 152, 166, 163, 174, 179,
      185, 174, 189, 184, 212, 202, 195, 178, 178, 174, 173, 155, 139, 136, 136,
      135, 130, 134, 130, 130, 130, 135, 135, 140, 140, 140, 141, 135, 127, 123,
      127, 130, 117, 122, 127, 143, 153, 136, 145, 155, 164, 159, 155, 132, 137,
      127, 132, 132, 127, 132, 132, 137, 144, 149, 149, 149, 154, 159, 159, 154,
      169, 175, 185, 191, 186, 170, 171, 177, 173, 173, 173, 173, 177, 192, 211,
      184, 178, 170, 170, 168, 164, 164, 164, 169, 184, 170, 146, 125, 125, 125,
      125, 125, 125, 125, 125, 130, 136, 133, 134, 138, 138, 138, 138, 143, 148,
      149, 156, 142, 145, 145, 148, 136, 139, 145, 145, 157, 154, 156, 137, 137,
      137, 137, 142, 147, 155, 159, 159, 159, 160, 157, 172, 195, 178, 180, 170,
      170, 175, 186, 193, 192, 186, 177, 182, 202, 200, 180, 171, 154, 159, 159,
      159, 159, 164, 164, 164, 164, 164, 164, 164, 169, 144, 148, 119, 115, 115,
      120, 131, 123, 127, 127, 127, 127, 127, 127, 131, 131, 127, 132, 132, 137,
      151, 147, 140, 139, 135, 137, 135, 135, 135, 135, 140, 145, 150, 158, 155,
      155, 154, 155, 157, 152, 163, 165, 163, 151, 151, 161, 161, 161, 161, 161,
      166, 171, 176, 198, 197, 171, 166, 154, 154, 154, 165, 165, 165, 165, 165,
      165, 165, 169, 169, 169, 169, 169, 174, 185,
    ],
    [
      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 10, 20, 30, 45, 55, 68, 79, 84, 89,
      95, 92, 98, 102, 105, 101, 102, 109, 114, 123, 128, 130, 115, 112, 119,
      103, 121, 121, 121, 125, 125, 132, 133, 148, 145, 140, 140, 140, 140, 151,
      151, 168, 169, 163, 156, 159, 153, 151, 153, 166, 185, 177, 169, 178, 188,
      193, 198, 205, 215, 176, 180, 173, 172, 177, 178, 145, 125, 120, 120, 125,
      125, 125, 125, 125, 125, 125, 125, 125, 125, 135, 146, 135, 142, 132, 138,
      136, 137, 154, 154, 154, 154, 154, 159, 164, 166, 163, 159, 137, 142, 132,
      132, 132, 132, 132, 132, 137, 137, 137, 142, 142, 142, 142, 154, 154, 159,
      165, 175, 173, 182, 156, 153, 158, 167, 172, 172, 172, 176, 176, 193, 161,
      179, 163, 174, 177, 177, 177, 182, 182, 181, 187, 195, 185, 182, 179, 170,
      154, 140, 146, 133, 129, 140, 135, 141, 136, 136, 136, 136, 146, 161, 173,
      192, 185, 178, 178, 185, 176, 181, 164, 169, 174, 174, 180, 170, 167, 157,
      157, 162, 162, 167, 175, 175, 167, 162, 162, 162, 163, 185, 172, 184, 186,
      191, 192, 195, 198, 192, 183, 183, 183, 187, 166, 167, 166, 166, 166, 166,
      166, 171, 171, 171, 171, 171, 171, 171, 175, 153, 141, 115, 116, 121, 121,
      128, 131, 139, 134, 138, 138, 138, 138, 138, 138, 133, 138, 143, 153, 168,
      155, 154, 141, 151, 151, 155, 155, 160, 160, 165, 165, 166, 159, 165, 164,
      169, 170, 169, 174, 180, 183, 182, 180, 184, 187, 187, 187, 193, 193, 198,
      198, 202, 214, 215, 198, 184, 173, 164, 164, 164, 165, 166, 176, 174, 169,
      169, 174, 175, 180, 180, 180, 180, 185,
    ],
    [
      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 10, 20, 30, 45, 55, 68, 79, 84, 89,
      95, 92, 98, 102, 105, 101, 102, 109, 114, 123, 128, 130, 115, 112, 119,
      103, 121, 121, 121, 125, 125, 132, 133, 148, 145, 140, 140, 140, 140, 151,
      151, 168, 169, 163, 156, 159, 153, 151, 153, 166, 185, 177, 169, 178, 188,
      193, 198, 205, 215, 176, 180, 173, 172, 177, 178, 145, 125, 120, 120, 125,
      125, 125, 125, 125, 125, 125, 125, 125, 125, 135, 146, 135, 142, 132, 138,
      136, 137, 154, 154, 154, 154, 154, 159, 164, 166, 163, 159, 137, 142, 132,
      132, 132, 132, 132, 132, 137, 137, 137, 142, 142, 142, 142, 154, 154, 159,
      165, 175, 173, 182, 156, 153, 158, 167, 172, 172, 172, 176, 176, 193, 161,
      179, 163, 174, 177, 177, 177, 182, 182, 181, 187, 195, 185, 182, 179, 170,
      154, 140, 146, 133, 129, 140, 135, 141, 136, 136, 136, 136, 146, 161, 173,
      192, 185, 178, 178, 185, 176, 181, 164, 169, 174, 174, 180, 170, 167, 157,
      157, 162, 162, 167, 175, 175, 167, 162, 162, 162, 163, 185, 172, 184, 186,
      191, 192, 195, 198, 192, 183, 183, 183, 187, 166, 167, 166, 166, 166, 166,
      166, 171, 171, 171, 171, 171, 171, 171, 175, 153, 141, 115, 116, 121, 121,
      128, 131, 139, 134, 138, 138, 138, 138, 138, 138, 133, 138, 143, 153, 168,
      155, 154, 141, 151, 151, 155, 155, 160, 160, 165, 165, 166, 159, 165, 164,
      169, 170, 169, 174, 180, 183, 182, 180, 184, 187, 187, 187, 193, 193, 198,
      198, 202, 214, 215, 198, 184, 173, 164, 164, 164, 165, 166, 176, 174, 169,
      169, 174, 175, 180, 180, 180, 180, 185,
    ],
    [
      0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 20, 43, 47, 47, 74, 79, 84, 89, 93, 99,
      109, 103, 103, 103, 98, 109, 109, 108, 107, 104, 104, 104, 114, 114, 114,
      123, 134, 135, 119, 127, 121, 123, 119, 120, 120, 125, 134, 134, 134, 134,
      134, 134, 134, 134, 134, 136, 126, 137, 128, 107, 111, 107, 118, 124, 125,
      121, 116, 122, 123, 126, 127, 127, 127, 127, 132, 132, 132, 132, 132, 136,
      136, 141, 141, 141, 136, 143, 144, 141, 141, 141, 141, 141, 141, 141, 141,
      141, 141, 141, 146, 146, 146, 148, 134, 132, 133, 130, 122, 119, 115, 115,
      120, 131, 128, 128, 128, 128, 128, 128, 128, 128, 128, 132, 132, 132, 137,
      142, 142, 142, 142, 142, 142, 142, 142, 142, 143, 144, 142, 142, 142, 142,
      142, 142, 147, 147, 152, 152, 152, 153, 139, 146, 138, 143, 148, 149, 166,
      168, 158, 149, 143, 148, 153, 158, 156, 154, 154, 142, 138, 133, 142, 140,
      135, 140, 140, 140, 140, 147, 145, 145, 145, 151, 157, 150, 150, 145, 145,
      145, 149, 149, 149, 149, 149, 149, 154, 154, 154, 154, 149, 149, 149, 149,
      149, 151, 144, 138, 143, 145, 155, 156, 152, 154, 134, 141, 150, 154, 170,
      176, 168, 168, 173, 166, 167, 162, 162, 162, 162, 162, 162, 164, 156, 151,
      143, 148, 153, 153, 158, 158, 158, 163, 163, 163, 163, 163, 163, 173, 178,
      178, 178, 178, 188, 188, 188, 188, 194, 194, 199, 197, 191, 188, 185, 168,
      165, 157, 158, 153, 153, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154,
      154, 154, 157, 123, 123, 106, 106, 111, 116, 113, 114, 111, 115, 115, 116,
      116, 117, 118, 124, 125, 126, 123, 123, 123,
    ],
    [
      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 10, 10, 20, 35, 55, 55, 60, 60, 66,
      71, 71, 66, 61, 61, 66, 66, 66, 61, 65, 61, 61, 62, 52, 59, 51, 30, 31,
      27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 32, 32, 37, 37, 36, 27,
      32, 40, 25, 16, 21, 27, 25, 25, 25, 25, 25, 25, 25, 25, 30, 40, 45, 49,
      50, 43, 39, 35, 30, 30, 35, 35, 34, 34, 39, 39, 39, 44, 44, 44, 44, 50,
      43, 44, 40, 40, 35, 35, 40, 40, 45, 50, 60, 60, 60, 55, 40, 41, 34, 35,
      30, 30, 25, 30, 30, 30, 35, 35, 35, 35, 35, 35, 35, 35, 35, 40, 45, 38,
      29, 40, 40, 45, 40, 45, 59, 64, 64, 64, 64, 64, 59, 59, 59, 59, 59, 59,
      59, 64, 64, 64, 49, 44, 44, 44, 44, 44, 44, 44, 50, 50, 55, 55, 50, 50,
      50, 55, 60, 60, 65, 65, 70, 67, 59, 60, 60, 61, 57, 45, 46, 46, 46, 46,
      48, 38, 35, 35, 40, 40, 35, 40, 50, 50, 55, 55, 60, 65, 70, 63, 59, 55,
      60, 60, 60, 60, 50, 55, 55, 55, 50, 60, 50, 57, 57, 62, 62, 62, 62, 67,
      67, 67, 67, 67, 72, 77, 77, 57, 52, 52, 58, 58, 58, 58, 58, 48, 48, 48,
      48, 53, 53, 53, 58, 58, 58, 58, 62, 63, 50, 47, 48, 48, 58, 53, 63, 63,
      63, 63, 63, 64, 61, 62, 62, 67, 77, 77, 77, 82, 83, 69, 66, 67, 67, 64,
      73, 73, 73, 73, 73, 73, 78, 78, 57, 58, 59, 54, 59, 59, 59, 59, 59, 59,
      64, 69, 69, 69, 69, 69, 69, 69, 74,
    ],
    [
      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 10, 20, 30, 45, 55, 68, 79, 84, 89,
      95, 92, 98, 102, 105, 101, 102, 109, 114, 123, 128, 130, 115, 112, 119,
      103, 121, 121, 121, 125, 125, 132, 133, 148, 145, 140, 140, 140, 140, 151,
      151, 168, 169, 163, 156, 159, 153, 151, 153, 166, 185, 177, 169, 178, 188,
      193, 198, 205, 215, 176, 180, 173, 172, 177, 178, 145, 125, 120, 120, 125,
      125, 125, 125, 125, 125, 125, 125, 125, 125, 135, 146, 135, 142, 132, 138,
      136, 137, 154, 154, 154, 154, 154, 159, 164, 166, 163, 159, 137, 142, 132,
      132, 132, 132, 132, 132, 137, 137, 137, 142, 142, 142, 142, 154, 154, 159,
      165, 175, 173, 182, 156, 153, 158, 167, 172, 172, 172, 176, 176, 193, 161,
      179, 163, 174, 177, 177, 177, 182, 182, 181, 187, 195, 185, 182, 179, 170,
      154, 140, 146, 133, 129, 140, 135, 141, 136, 136, 136, 136, 146, 161, 173,
      192, 185, 178, 178, 185, 176, 181, 164, 169, 174, 174, 180, 170, 167, 157,
      157, 162, 162, 167, 175, 175, 167, 162, 162, 162, 163, 185, 172, 184, 186,
      191, 192, 195, 198, 192, 183, 183, 183, 187, 166, 167, 166, 166, 166, 166,
      166, 171, 171, 171, 171, 171, 171, 171, 175, 153, 141, 115, 116, 121, 121,
      128, 131, 139, 134, 138, 138, 138, 138, 138, 138, 133, 138, 143, 153, 168,
      155, 154, 141, 151, 151, 155, 155, 160, 160, 165, 165, 166, 159, 165, 164,
      169, 170, 169, 174, 180, 183, 182, 180, 184, 187, 187, 187, 193, 193, 198,
      198, 202, 214, 215, 198, 184, 173, 164, 164, 164, 165, 166, 176, 174, 169,
      169, 174, 175, 180, 180, 180, 180, 185,
    ],
    [
      0, 0, 0, 0, 0, 0, 4, 4, 9, 15, 33, 33, 42, 47, 47, 52, 52, 52, 52, 57, 57,
      57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57,
      57, 57, 57, 57, 57, 57, 24, 10, 0, 0, 0, 0, 0, 0, 4, 9, 24, 27, 40, 46,
      42, 42, 57, 74, 79, 79, 79, 84, 89, 89, 89, 89, 94, 94, 94, 94, 94, 94,
      94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 86, 78, 75, 68, 65,
      70, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 60, 57, 57, 57, 57, 57, 57,
      57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57,
      57, 57, 57, 57, 17, 7, 0, 0, 0, 0, 0, 4, 12, 20, 24, 30, 33, 51, 51, 56,
      62, 66, 79, 79, 79, 89, 89, 89, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
      94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 86, 85, 85, 78, 75, 75, 75,
      75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
      75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
      75, 75, 53, 50, 46, 46, 46, 46, 46, 46, 51, 51, 55, 60, 60, 65, 65, 65,
      65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
      65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 57, 58, 56, 48, 46, 46, 46,
      46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46,
      46, 46, 46, 46, 46,
    ],
    [
      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 10, 10,
      20, 20, 26, 39, 45, 45, 45, 45, 49, 49, 49, 49, 49, 49, 49, 49, 49, 57,
      57, 57, 50, 36, 29, 22, 19, 15, 25, 40, 54, 59, 59, 64, 64, 64, 64, 64,
      64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
      64, 64, 64, 57, 53, 53, 53, 53, 53, 58, 64, 64, 40, 39, 27, 27, 24, 47,
      46, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
      70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
      70, 62, 60, 33, 32, 30, 30, 40, 49, 56, 56, 64, 64, 64, 64, 64, 64, 64,
      64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 58,
      53, 53, 53, 58, 64, 64, 64, 64, 64, 64, 65, 62, 55, 45, 34, 39, 39, 49,
      62, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
      70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
      70, 62, 64, 39, 30, 30, 35, 40, 49, 78, 64, 64, 64, 64, 64, 64, 64, 64,
      64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
      64, 65, 58, 53, 53, 53, 58, 64, 64, 64, 57, 62, 47, 49, 42, 50, 45, 49,
      58, 58, 62, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
      70, 70, 70, 70, 70, 70,
    ],
    [
      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
      2, 2, 2, 2, 2, 0, 0, 0, 0, 5, 5, 5, 5, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
      8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 1, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
      2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2,
      2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 0, 0, 5, 5,
      5, 5, 5, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
      11, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
      2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
      2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 5, 5, 5, 5, 8, 8, 8, 8, 8, 8, 8,
      8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 3, 4, 2, 2, 2, 2, 2, 2,
      2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 7, 7, 5, 5, 2,
      2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
      2, 2,
    ],
  ];
  var allSeries = [
    {
      name: "安全距离",
      type: "line",
      smooth: true,
      data: ydata[0],
    },
    {
      name: "智能驾驶员",
      type: "line",
      smooth: true,
      data: ydata[1],
    },
    {
      name: "静态",
      type: "line",
      smooth: true,
      data: ydata[2],
    },
    {
      name: "动态",
      type: "line",
      smooth: true,
      data: ydata[3],
    },
    {
      name: "低强度",
      type: "line",
      smooth: true,
      data: ydata[4],
    },
    {
      name: "高强度",
      type: "line",
      smooth: true,
      data: ydata[5],
    },
    {
      name: "circle交叉口",
      type: "line",
      smooth: true,
      data: ydata[6],
    },
    {
      name: "cross交叉口",
      type: "line",
      smooth: true,
      data: ydata[7],
    },
    {
      name: "t交叉口",
      type: "line",
      smooth: true,
      data: ydata[8],
    },
  ];
  // 1. 实例化对象
  var myChart = echarts.init(document.querySelector(".bar2 .chart"));
  // 2.指定配置
  var option = {
    // 通过这个color修改两条线的颜色
    color: [
      "#00f2f1",
      "#ed3f35",
      "#1089E7",
      "#F57474",
      "#56D0E3",
      "#F8B448",
      "#8B78F6",
    ],
    tooltip: {
      trigger: "axis",
    },
    legend: {
      // 如果series 对象有name 值，则 legend可以不用写data
      // 修改图例组件 文字颜色
      textStyle: {
        color: "#4c9bfd",
      },
      // 这个10% 必须加引号
      right: "10%",
    },
    grid: {
      top: "20%",
      left: "3%",
      right: "4%",
      bottom: "3%",
      show: true, // 显示边框
      borderColor: "#012f4a", // 边框颜色
      containLabel: true, // 包含刻度文字在内
    },

    xAxis: {
      type: "category",
      boundaryGap: false,
      data: [
        0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
        20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
        38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
        56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73,
        74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
        92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107,
        108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
        122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135,
        136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
        150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163,
        164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177,
        178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
        192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205,
        206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219,
        220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233,
        234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247,
        248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261,
        262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275,
        276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289,
        290, 291, 292, 293, 294, 295, 296, 297, 298, 299,
      ],
      axisTick: {
        show: false, // 去除刻度线
      },
      axisLabel: {
        color: "#4c9bfd", // 文本颜色
      },
      axisLine: {
        show: false, // 去除轴线
      },
    },
    yAxis: {
      type: "value",
      axisTick: {
        show: false, // 去除刻度线
      },
      axisLabel: {
        color: "#4c9bfd", // 文本颜色
      },
      axisLine: {
        show: false, // 去除轴线
      },
      splitLine: {
        lineStyle: {
          color: "#012f4a", // 分割线颜色
        },
      },
    },
    series: [],
  };

  // 3. 把配置给实例对象
  myChart.setOption(option);
  // 4. 让图表跟随屏幕自动的去适应
  window.addEventListener("resize", function () {
    myChart.resize();
  });
  // 5.点击切换效果
  $(".bar2 h2").on("click", "a", function () {
    this.style.color = "#ff4d4d";
    option.series.length = 0;
    console.log(option.series);
    console.log($(this).index());
    // 点击 a 之后 根据当前a的索引号 找到对应的 yearData的相关对象
    // console.log(yearData[$(this).index()]);
    // var obj = yearData[$(this).index()];
    if ($(this).index() == 3) {
      option.series.push(allSeries[$(this).index() * 2]);
      option.series.push(allSeries[$(this).index() * 2 + 1]);
      option.series.push(allSeries[$(this).index() * 2 + 2]);
    } else {
      option.series.push(allSeries[$(this).index() * 2]);
      option.series.push(allSeries[$(this).index() * 2 + 1]);
      option.series[2] = allSeries[$(this).index() * 2 + 1];
    }
    // 需要重新渲染
    myChart.setOption(option);
  });
})();

// 来车数量
(function () {
  var ydata = [
    [
      15, 13, 9, 12, 7, 10, 13, 7, 9, 11, 14, 8, 10, 11, 10, 9, 10, 10, 10, 7,
      12, 10, 8, 8, 11, 8, 8, 6, 5, 5, 7, 5, 3, 5, 4, 5, 2, 4, 2, 3, 2, 2, 3, 3,
      3, 3, 2, 2, 3, 2, 3, 3, 2, 2, 2, 2, 1, 3, 1, 3, 2, 2, 3, 3, 2, 1, 3, 6, 2,
      3, 4, 3, 2, 4, 4, 2, 3, 3, 5, 2, 1, 2, 3, 1, 2, 2, 3, 3, 1, 2, 4, 1, 1, 2,
      2, 0, 1, 2, 2, 1, 1, 0, 1, 0, 1, 0, 0, 0, 2, 0, 1, 2, 3, 1, 0, 3, 1, 0, 0,
      1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 2, 0, 0, 2, 0, 0, 0, 2, 2, 0, 0, 0,
      2, 1, 1, 1, 3, 1, 0, 1, 2, 0, 1, 2, 0, 1, 0, 3, 2, 1, 2, 2, 3, 1, 2, 5, 0,
      0, 3, 2, 0, 3, 1, 0, 4, 1, 3, 3, 3, 3, 3, 3, 3, 2, 2, 0, 3, 0, 0, 1, 4, 2,
      1, 3, 1, 3, 4, 1, 2, 4, 2, 0, 2, 1, 2, 1, 0, 2, 0, 1, 1, 1, 1, 0, 2, 1, 0,
      2, 0, 1, 1, 3, 2, 0, 0, 0, 2, 1, 1, 2, 1, 2, 2, 3, 4, 1, 3, 0, 4, 2, 3, 4,
      2, 3, 1, 4, 1, 4, 4, 1, 1, 6, 2, 0, 2, 1, 2, 0, 0, 1, 1, 2, 0, 2, 1, 0, 3,
      3, 0, 1, 0, 0, 1, 0, 2, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0,
      1, 1, 0, 0, 0, 1,
    ],
    [
      15, 13, 9, 12, 7, 10, 13, 7, 9, 11, 14, 8, 9, 9, 11, 7, 12, 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2, 2, 0, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0,
      1, 1, 0, 1, 1, 0, 1, 0, 0, 2, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    ],
  ];
  var allSeries = [
    {
      name: "安全距离",
      type: "line",
      smooth: true,
      data: ydata[0],
    },
    {
      name: "智能驾驶员",
      type: "line",
      smooth: true,
      data: ydata[1],
    },
    {
      name: "静态",
      type: "line",
      smooth: true,
      data: ydata[2],
    },
    {
      name: "动态",
      type: "line",
      smooth: true,
      data: ydata[3],
    },
    {
      name: "低强度",
      type: "line",
      smooth: true,
      data: ydata[4],
    },
    {
      name: "高强度",
      type: "line",
      smooth: true,
      data: ydata[5],
    },
    {
      name: "circle交叉口",
      type: "line",
      smooth: true,
      data: ydata[6],
    },
    {
      name: "cross交叉口",
      type: "line",
      smooth: true,
      data: ydata[7],
    },
    {
      name: "t交叉口",
      type: "line",
      smooth: true,
      data: ydata[8],
    },
  ];
  // 1. 实例化对象
  var myChart = echarts.init(document.querySelector(".line2 .chart"));
  // 2.指定配置
  var option = {
    // 通过这个color修改两条线的颜色
    color: [
      "#00f2f1",
      "#ed3f35",
      "#1089E7",
      "#F57474",
      "#56D0E3",
      "#F8B448",
      "#8B78F6",
    ],
    tooltip: {
      trigger: "axis",
    },
    legend: {
      // 如果series 对象有name 值，则 legend可以不用写data
      // 修改图例组件 文字颜色
      textStyle: {
        color: "#4c9bfd",
      },
      // 这个10% 必须加引号
      right: "10%",
    },
    grid: {
      top: "20%",
      left: "3%",
      right: "4%",
      bottom: "3%",
      show: true, // 显示边框
      borderColor: "#012f4a", // 边框颜色
      containLabel: true, // 包含刻度文字在内
    },

    xAxis: {
      type: "category",
      boundaryGap: false,
      data: [
        0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
        20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
        38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
        56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73,
        74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
        92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107,
        108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
        122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135,
        136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
        150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163,
        164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177,
        178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
        192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205,
        206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219,
        220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233,
        234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247,
        248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261,
        262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275,
        276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289,
        290, 291, 292, 293, 294, 295, 296, 297, 298, 299,
      ],
      axisTick: {
        show: false, // 去除刻度线
      },
      axisLabel: {
        color: "#4c9bfd", // 文本颜色
      },
      axisLine: {
        show: false, // 去除轴线
      },
    },
    yAxis: {
      type: "value",
      axisTick: {
        show: false, // 去除刻度线
      },
      axisLabel: {
        color: "#4c9bfd", // 文本颜色
      },
      axisLine: {
        show: false, // 去除轴线
      },
      splitLine: {
        lineStyle: {
          color: "#012f4a", // 分割线颜色
        },
      },
    },
    series: [],
  };

  // 3. 把配置给实例对象
  myChart.setOption(option);
  // 4. 让图表跟随屏幕自动的去适应
  window.addEventListener("resize", function () {
    myChart.resize();
  });

  // 5.点击切换效果
  $(".line2 h2").on("click", "a", function () {
    this.style.color = "#ff4d4d";
    option.series.length = 0;
    console.log(option.series);
    console.log($(this).index());
    // 点击 a 之后 根据当前a的索引号 找到对应的 yearData的相关对象
    // console.log(yearData[$(this).index()]);
    // var obj = yearData[$(this).index()];
    if ($(this).index() == 3) {
      option.series.push(allSeries[$(this).index() * 2]);
      option.series.push(allSeries[$(this).index() * 2 + 1]);
      option.series.push(allSeries[$(this).index() * 2 + 2]);
    } else {
      option.series.push(allSeries[$(this).index() * 2]);
      option.series.push(allSeries[$(this).index() * 2 + 1]);
      option.series[2] = allSeries[$(this).index() * 2 + 1];
    }
    myChart.setOption(option);
  });
})();

// 离开数量
(function () {
  var ydata = [
    [
      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
      1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 1, 1,
      1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 3, 0,
      1, 1, 0, 0, 2, 2, 1, 1, 1, 1, 0, 0, 0, 1, 2, 1, 2, 2, 1, 2, 2, 2, 1, 2, 1,
      0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 2, 0, 1, 1, 1, 1, 1, 3, 1, 1, 0, 0,
      0, 1, 1, 1, 0, 1, 3, 1, 2, 2, 2, 3, 3, 4, 1, 1, 2, 0, 0, 0, 0, 3, 0, 1, 1,
      0, 3, 0, 1, 1, 1, 0, 2, 2, 3, 1, 2, 3, 2, 1, 2, 1, 0, 2, 1, 0, 2, 2, 2, 1,
      1, 1, 0,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, 1, 2, 1, 1, 1, 1, 0,
      2, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 2, 1, 0, 1, 0, 2, 0, 1, 0, 1, 2, 0, 2,
      2, 0, 3, 0, 1, 0, 1, 0, 0, 0, 2, 1, 0, 1, 0, 2, 0, 0, 2, 0, 2, 0, 1, 0, 1,
      1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 2, 0, 1, 1, 2, 0, 2,
      0, 2, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 2, 0,
      0, 2, 0, 2, 0, 2, 1, 1, 1, 0, 0, 1, 1, 1, 2, 0, 1, 2, 2, 0, 1, 1, 1, 0, 0,
      3, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 2, 1, 0, 2, 0, 2, 0, 0, 0, 2, 0, 1,
      0, 1, 0, 0, 0, 0, 1, 2, 2, 1, 1, 1, 1, 0, 3, 1, 1, 1, 1, 1, 1, 2, 0, 2, 0,
    ],
  ];
  var allSeries = [
    {
      name: "安全距离",
      type: "line",
      smooth: true,
      data: ydata[0],
    },
    {
      name: "智能驾驶员",
      type: "line",
      smooth: true,
      data: ydata[1],
    },
    {
      name: "静态",
      type: "line",
      smooth: true,
      data: ydata[2],
    },
    {
      name: "动态",
      type: "line",
      smooth: true,
      data: ydata[3],
    },
    {
      name: "低强度",
      type: "line",
      smooth: true,
      data: ydata[4],
    },
    {
      name: "高强度",
      type: "line",
      smooth: true,
      data: ydata[5],
    },
    {
      name: "circle交叉口",
      type: "line",
      smooth: true,
      data: ydata[6],
    },
    {
      name: "cross交叉口",
      type: "line",
      smooth: true,
      data: ydata[7],
    },
    {
      name: "t交叉口",
      type: "line",
      smooth: true,
      data: ydata[8],
    },
  ];
  // 1. 实例化对象
  var myChart = echarts.init(document.querySelector(".bar3 .chart"));
  // 2.指定配置
  var option = {
    // 通过这个color修改两条线的颜色
    color: [
      "#00f2f1",
      "#ed3f35",
      "#1089E7",
      "#F57474",
      "#56D0E3",
      "#F8B448",
      "#8B78F6",
    ],
    tooltip: {
      trigger: "axis",
    },
    legend: {
      // 如果series 对象有name 值，则 legend可以不用写data
      // 修改图例组件 文字颜色
      textStyle: {
        color: "#4c9bfd",
      },
      // 这个10% 必须加引号
      right: "10%",
    },
    grid: {
      top: "20%",
      left: "3%",
      right: "4%",
      bottom: "3%",
      show: true, // 显示边框
      borderColor: "#012f4a", // 边框颜色
      containLabel: true, // 包含刻度文字在内
    },

    xAxis: {
      type: "category",
      boundaryGap: false,
      data: [
        0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
        20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
        38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
        56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73,
        74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
        92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107,
        108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
        122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135,
        136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
        150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163,
        164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177,
        178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
        192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205,
        206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219,
        220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233,
        234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247,
        248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261,
        262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275,
        276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289,
        290, 291, 292, 293, 294, 295, 296, 297, 298, 299,
      ],
      axisTick: {
        show: false, // 去除刻度线
      },
      axisLabel: {
        color: "#4c9bfd", // 文本颜色
      },
      axisLine: {
        show: false, // 去除轴线
      },
    },
    yAxis: {
      type: "value",
      axisTick: {
        show: false, // 去除刻度线
      },
      axisLabel: {
        color: "#4c9bfd", // 文本颜色
      },
      axisLine: {
        show: false, // 去除轴线
      },
      splitLine: {
        lineStyle: {
          color: "#012f4a", // 分割线颜色
        },
      },
    },
    series: [],
  };

  // 3. 把配置给实例对象
  myChart.setOption(option);
  // 4. 让图表跟随屏幕自动的去适应
  window.addEventListener("resize", function () {
    myChart.resize();
  });
  // 5.点击切换效果
  $(".bar3 h2").on("click", "a", function () {
    this.style.color = "#ff4d4d";
    option.series.length = 0;
    console.log(option.series);
    console.log($(this).index());
    // 点击 a 之后 根据当前a的索引号 找到对应的 yearData的相关对象
    // console.log(yearData[$(this).index()]);
    // var obj = yearData[$(this).index()];
    if ($(this).index() == 3) {
      option.series.push(allSeries[$(this).index() * 2]);
      option.series.push(allSeries[$(this).index() * 2 + 1]);
      option.series.push(allSeries[$(this).index() * 2 + 2]);
    } else {
      option.series.push(allSeries[$(this).index() * 2]);
      option.series.push(allSeries[$(this).index() * 2 + 1]);
      option.series[2] = allSeries[$(this).index() * 2 + 1];
    }
    myChart.setOption(option);
  });
})();

// 堵车数量
(function () {
  var ydata = [
    [
      0.01, 0.03, 0.04, 0.05, 0.07, 0.08, 0.1, 0.12, 0.15, 0.18, 0.21, 0.24,
      0.29, 0.35, 0.41, 0.49, 0.52, 0.63, 0.77, 0.8, 1, 1.04, 1.08, 1.36, 1.42,
      1.46, 1.91, 1.95, 1.98, 2.02, 2.79, 2.83, 2.86, 2.91, 2.95, 3, 3.02, 3.05,
      3.07, 3.09, 3.11, 3.13, 3.16, 3.19, 3.22, 3.23, 3.25, 4.97, 5, 5.01, 5.04,
      5.07, 5.1, 5.13, 5.14, 5.17, 5.17, 5.22, 5.23, 5.27, 5.3, 5.3, 10.81,
      10.9, 10.96, 10.99, 11.07, 11.22, 11.28, 11.37, 11.46, 11.52, 11.55,
      11.58, 11.7, 11.73, 11.79, 11.87, 12.02, 12.02, 11.99, 12.02, 12.08,
      12.08, 12.11, 12.17, 12.26, 6.09, 6.09, 6.09, 6.14, 12.41, 12.38, 12.41,
      12.41, 12.35, 12.32, 12.35, 12.35, 12.35, 12.38, 12.35, 12.35, 12.35,
      12.35, 12.32, 12.32, 12.32, 12.38, 12.38, 12.41, 12.44, 6.18, 12.5, 6.17,
      6.2, 6.2, 6.18, 6.17, 6.17, 6.14, 6.14, 6.14, 6.14, 6.14, 6.15, 6.14,
      6.12, 6.12, 6.12, 6.11, 6.08, 6.09, 6.06, 6.04, 6.04, 12.14, 12.05, 11.93,
      11.96, 11.99, 11.93, 11.93, 11.93, 11.99, 12.02, 11.96, 11.99, 12.05,
      12.05, 12.05, 11.99, 12.05, 5.93, 5.93, 5.95, 5.95, 5.93, 5.9, 5.9, 5.92,
      5.9, 5.89, 5.89, 5.92, 5.9, 5.92, 5.99, 5.96, 5.95, 5.99, 5.99, 5.96,
      5.98, 5.98, 5.96, 6.01, 6.02, 6.06, 6.11, 6.15, 6.2, 6.24, 6.28, 6.33,
      6.34, 6.36, 6.36, 6.39, 6.39, 6.37, 6.36, 6.42, 6.44, 4.24, 4.26, 6.47,
      6.52, 6.58, 6.58, 6.59, 6.62, 6.62, 6.62, 6.62, 6.61, 6.61, 6.61, 13.33,
      13.36, 13.3, 13.3, 13.24, 13.24, 13.27, 13.27, 13.3, 13.27, 13.27, 13.3,
      13.27, 13.27, 13.3, 13.39, 6.63, 6.62, 6.62, 6.61, 6.62, 6.58, 6.53, 6.55,
      6.5, 6.49, 6.49, 6.49, 6.52, 6.5, 6.53, 6.52, 6.53, 6.53, 6.58, 6.62,
      6.63, 6.65, 6.66, 6.68, 6.68, 6.71, 6.74, 6.72, 6.69, 6.75, 6.74, 6.74,
      6.72, 6.72, 6.75, 6.74, 6.74, 6.74, 6.74, 6.75, 6.75, 6.78, 6.8, 6.8,
      6.84, 6.87, 6.84, 6.81, 6.81, 6.77, 6.77, 6.74, 6.77, 6.75, 6.75, 6.72,
      13.59, 13.56, 13.5, 13.47, 13.44, 13.44, 13.39, 13.42, 13.39, 13.39,
      13.33, 13.33, 13.3, 6.55, 6.55, 6.55, 6.55, 6.55, 6.55, 6.52,
    ],
    [
      0.01, 0.03, 0.04, 0.06, 0.07, 0.09, 0.11, 0.13, 0.16, 0.2, 0.25, 0.3,
      0.35, 0.43, 0.52, 0.64, 0.68, 0.83, 0.87, 1.1, 1.13, 1.18, 1.55, 1.58,
      1.63, 1.66, 1.71, 2.34, 2.36, 2.4, 2.43, 2.44, 2.46, 2.51, 2.53, 2.56,
      2.56, 2.6, 2.66, 2.68, 2.71, 2.75, 2.8, 2.83, 2.84, 2.86, 2.89, 2.92,
      2.95, 2.97, 3.03, 3.03, 3.05, 3.07, 3.08, 3.13, 3.17, 4.91, 4.97, 5.03,
      5.04, 5.1, 5.08, 5.16, 5.22, 5.25, 5.27, 5.35, 5.39, 5.44, 5.46, 5.46,
      5.54, 11.16, 5.57, 5.65, 5.71, 5.74, 5.8, 5.83, 5.89, 5.87, 5.92, 5.95,
      5.93, 5.99, 6.02, 6.01, 6.02, 6.05, 6.08, 6.09, 6.09, 6.08, 6.14, 6.15,
      6.11, 6.11, 6.11, 6.09, 6.11, 6.11, 6.12, 6.17, 6.17, 6.2, 6.2, 6.25,
      6.28, 6.31, 6.34, 6.36, 6.43, 6.42, 6.46, 6.52, 6.5, 6.52, 6.56, 6.53,
      6.53, 6.56, 6.56, 6.58, 6.61, 6.62, 6.65, 6.68, 6.69, 6.69, 6.72, 6.71,
      6.68, 6.71, 6.66, 6.66, 6.62, 6.65, 13.39, 13.44, 13.33, 13.33, 13.24,
      13.24, 13.27, 13.3, 13.27, 13.24, 13.24, 13.18, 13.18, 13.12, 13.12,
      13.12, 13.06, 6.44, 6.4, 6.42, 6.39, 6.34, 6.33, 6.3, 6.25, 6.23, 6.2,
      6.18, 6.15, 6.15, 6.15, 6.14, 6.15, 6.18, 6.21, 6.23, 6.25, 6.25, 6.27,
      6.25, 6.24, 6.25, 6.25, 6.24, 6.21, 6.24, 6.3, 6.3, 6.28, 6.3, 6.31, 6.31,
      6.33, 6.36, 6.37, 6.37, 6.42, 6.44, 6.47, 6.49, 6.52, 6.55, 6.58, 6.56,
      6.55, 6.55, 6.58, 6.59, 6.59, 13.42, 13.39, 13.42, 13.42, 13.36, 13.3,
      13.3, 13.27, 13.27, 13.27, 13.27, 13.27, 13.27, 13.27, 13.3, 13.24, 13.24,
      13.21, 13.21, 13.21, 6.52, 6.47, 6.44, 6.43, 6.37, 6.37, 6.33, 6.31, 6.3,
      6.25, 6.24, 6.23, 6.21, 6.23, 6.18, 6.18, 6.24, 6.25, 6.23, 6.2, 6.2, 6.2,
      6.23, 6.18, 6.2, 6.17, 6.21, 6.2, 6.21, 6.23, 6.24, 6.28, 6.28, 6.36,
      6.39, 6.43, 6.47, 6.49, 6.55, 6.55, 6.56, 6.61, 6.62, 6.62, 6.58, 6.59,
      6.59, 6.55, 6.56, 6.55, 6.53, 13.18, 13.18, 13.12, 13.06, 13.06, 13.06,
      13.06, 13.06, 13.03, 13.06, 13.09, 13.09, 13.06, 13.06, 13.03, 13.06,
      6.46, 6.44, 6.46, 6.47, 6.46, 6.47,
    ],
    [
      0.01, 0.03, 0.04, 0.06, 0.07, 0.09, 0.11, 0.13, 0.16, 0.2, 0.25, 0.3,
      0.35, 0.43, 0.52, 0.64, 0.68, 0.83, 0.87, 1.1, 1.13, 1.18, 1.55, 1.58,
      1.63, 1.66, 1.71, 2.34, 2.36, 2.4, 2.43, 2.44, 2.46, 2.51, 2.53, 2.56,
      2.56, 2.6, 2.66, 2.68, 2.71, 2.75, 2.8, 2.83, 2.84, 2.86, 2.89, 2.92,
      2.95, 2.97, 3.03, 3.03, 3.05, 3.07, 3.08, 3.13, 3.17, 4.91, 4.97, 5.03,
      5.04, 5.1, 5.08, 5.16, 5.22, 5.25, 5.27, 5.35, 5.39, 5.44, 5.46, 5.46,
      5.54, 11.16, 5.57, 5.65, 5.71, 5.74, 5.8, 5.83, 5.89, 5.87, 5.92, 5.95,
      5.93, 5.99, 6.02, 6.01, 6.02, 6.05, 6.08, 6.09, 6.09, 6.08, 6.14, 6.15,
      6.11, 6.11, 6.11, 6.09, 6.11, 6.11, 6.12, 6.17, 6.17, 6.2, 6.2, 6.25,
      6.28, 6.31, 6.34, 6.36, 6.43, 6.42, 6.46, 6.52, 6.5, 6.52, 6.56, 6.53,
      6.53, 6.56, 6.56, 6.58, 6.61, 6.62, 6.65, 6.68, 6.69, 6.69, 6.72, 6.71,
      6.68, 6.71, 6.66, 6.66, 6.62, 6.65, 13.39, 13.44, 13.33, 13.33, 13.24,
      13.24, 13.27, 13.3, 13.27, 13.24, 13.24, 13.18, 13.18, 13.12, 13.12,
      13.12, 13.06, 6.44, 6.4, 6.42, 6.39, 6.34, 6.33, 6.3, 6.25, 6.23, 6.2,
      6.18, 6.15, 6.15, 6.15, 6.14, 6.15, 6.18, 6.21, 6.23, 6.25, 6.25, 6.27,
      6.25, 6.24, 6.25, 6.25, 6.24, 6.21, 6.24, 6.3, 6.3, 6.28, 6.3, 6.31, 6.31,
      6.33, 6.36, 6.37, 6.37, 6.42, 6.44, 6.47, 6.49, 6.52, 6.55, 6.58, 6.56,
      6.55, 6.55, 6.58, 6.59, 6.59, 13.42, 13.39, 13.42, 13.42, 13.36, 13.3,
      13.3, 13.27, 13.27, 13.27, 13.27, 13.27, 13.27, 13.27, 13.3, 13.24, 13.24,
      13.21, 13.21, 13.21, 6.52, 6.47, 6.44, 6.43, 6.37, 6.37, 6.33, 6.31, 6.3,
      6.25, 6.24, 6.23, 6.21, 6.23, 6.18, 6.18, 6.24, 6.25, 6.23, 6.2, 6.2, 6.2,
      6.23, 6.18, 6.2, 6.17, 6.21, 6.2, 6.21, 6.23, 6.24, 6.28, 6.28, 6.36,
      6.39, 6.43, 6.47, 6.49, 6.55, 6.55, 6.56, 6.61, 6.62, 6.62, 6.58, 6.59,
      6.59, 6.55, 6.56, 6.55, 6.53, 13.18, 13.18, 13.12, 13.06, 13.06, 13.06,
      13.06, 13.06, 13.03, 13.06, 13.09, 13.09, 13.06, 13.06, 13.03, 13.06,
      6.46, 6.44, 6.46, 6.47, 6.46, 6.47,
    ],
    [
      0.01, 0.03, 0.04, 0.06, 0.07, 0.09, 0.12, 0.15, 0.18, 0.22, 0.28, 0.37,
      0.46, 0.57, 0.6, 0.76, 0.98, 1.04, 1.36, 1.42, 1.46, 2.03, 2.05, 2.1,
      2.12, 2.19, 2.2, 2.24, 2.25, 2.28, 2.31, 2.34, 2.36, 2.43, 2.45, 2.47,
      2.51, 2.53, 2.56, 2.6, 2.63, 2.67, 2.7, 2.72, 2.75, 2.75, 2.8, 4.27, 2.83,
      2.87, 4.38, 2.92, 2.95, 4.48, 4.54, 4.59, 4.65, 4.69, 4.73, 4.75, 4.78,
      4.81, 4.82, 4.85, 4.87, 4.91, 4.95, 4.97, 5.04, 5.06, 5.07, 5.07, 5.14,
      5.16, 5.22, 5.2, 5.29, 5.32, 5.32, 5.36, 5.39, 5.39, 5.46, 5.45, 5.46,
      5.51, 5.54, 5.52, 5.54, 5.58, 5.58, 5.61, 5.58, 5.64, 5.67, 5.68, 5.71,
      5.73, 5.76, 5.74, 5.74, 5.73, 5.77, 5.76, 5.79, 5.8, 5.85, 5.82, 5.86,
      5.87, 5.9, 5.92, 5.95, 5.98, 6.01, 6.01, 6.01, 6.04, 6.08, 6.06, 6.09,
      6.11, 6.12, 6.14, 6.15, 6.18, 6.18, 6.2, 6.2, 6.18, 6.23, 6.24, 6.24,
      6.23, 6.24, 6.21, 6.23, 6.21, 6.21, 6.18, 6.2, 6.12, 6.14, 6.12, 6.09,
      6.11, 6.11, 6.08, 6.09, 6.08, 6.11, 6.12, 6.14, 6.15, 6.15, 6.14, 6.12,
      12.38, 12.41, 12.47, 12.41, 12.41, 12.38, 12.38, 12.32, 12.32, 12.29,
      12.32, 12.35, 12.35, 12.32, 12.29, 12.35, 6.11, 6.09, 12.35, 6.11, 12.32,
      12.32, 12.32, 12.32, 12.26, 12.26, 12.23, 12.23, 12.23, 12.26, 12.23,
      12.23, 12.23, 12.23, 12.2, 12.2, 12.17, 12.17, 12.11, 5.98, 5.98, 5.99,
      5.99, 5.98, 5.98, 5.96, 5.96, 5.95, 5.96, 5.98, 5.95, 5.95, 5.93, 5.9,
      5.93, 5.93, 5.93, 5.95, 5.93, 5.95, 5.95, 5.95, 5.95, 5.96, 5.95, 5.93,
      5.95, 5.96, 5.96, 5.95, 11.99, 12.08, 12.05, 12.02, 11.99, 12.02, 12.02,
      12.05, 12.14, 12.17, 12.17, 12.23, 12.23, 12.35, 12.32, 12.32, 12.35,
      12.38, 12.41, 12.44, 12.44, 12.47, 12.5, 12.44, 12.5, 12.5, 12.59, 12.56,
      12.5, 12.53, 12.41, 12.47, 12.44, 12.41, 12.38, 12.38, 12.26, 12.26,
      12.23, 12.2, 12.17, 12.23, 12.23, 12.2, 12.2, 12.23, 12.23, 6.06, 6.05,
      6.06, 6.06, 6.05, 6.02, 6.01, 5.99, 5.99, 6.01, 5.98, 5.93, 5.9, 5.93,
      5.87, 5.9, 5.89, 5.89, 5.89, 5.89, 5.87, 5.87, 5.87, 5.83, 5.8, 5.82,
    ],
    [
      0.01, 0.03, 0.03, 0.03, 0.03, 0.04, 0.04, 0.04, 0.05, 0.05, 0.06, 0.07,
      0.08, 0.11, 0.13, 0.13, 0.13, 0.13, 0.13, 0.14, 0.14, 0.14, 0.14, 0.14,
      0.12, 0.12, 0.12, 0.13, 0.13, 0.1, 0.12, 0.11, 0.11, 0.11, 0.11, 0.11,
      0.1, 0.1, 0.1, 0.09, 0.09, 0.09, 0.08, 0.08, 0.08, 0.08, 0.08, 0.08, 0.08,
      0.08, 0.09, 0.09, 0.09, 0.09, 0.1, 0.1, 0.1, 0.09, 0.09, 0.08, 0.09, 0.08,
      0.07, 0.07, 0.07, 0.07, 0.08, 0.08, 0.08, 0.08, 0.08, 0.09, 0.08, 0.09,
      0.08, 0.08, 0.07, 0.08, 0.07, 0.07, 0.08, 0.07, 0.07, 0.08, 0.08, 0.08,
      0.07, 0.07, 0.07, 0.07, 0.07, 0.07, 0.08, 0.08, 0.08, 0.09, 0.1, 0.1, 0.1,
      0.1, 0.1, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11,
      0.11, 0.11, 0.11, 0.1, 0.09, 0.1, 0.09, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
      0.11, 0.11, 0.11, 0.12, 0.12, 0.14, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15,
      0.15, 0.13, 0.13, 0.13, 0.13, 0.11, 0.12, 0.11, 0.1, 0.11, 0.11, 0.11,
      0.1, 0.1, 0.12, 0.1, 0.1, 0.12, 0.12, 0.12, 0.12, 0.12, 0.11, 0.11, 0.11,
      0.11, 0.11, 0.11, 0.13, 0.13, 0.13, 0.12, 0.14, 0.16, 0.14, 0.13, 0.13,
      0.12, 0.15, 0.15, 0.15, 0.15, 0.15, 0.14, 0.14, 0.14, 0.14, 0.14, 0.15,
      0.14, 0.15, 0.18, 0.17, 0.15, 0.15, 0.15, 0.18, 0.18, 0.18, 0.18, 0.17,
      0.17, 0.18, 0.16, 0.16, 0.17, 0.15, 0.16, 0.16, 0.16, 0.19, 0.19, 0.16,
      0.16, 0.16, 0.17, 0.17, 0.14, 0.14, 0.13, 0.15, 0.15, 0.15, 0.15, 0.15,
      0.15, 0.15, 0.14, 0.15, 0.15, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13,
      0.13, 0.13, 0.13, 0.14, 0.14, 0.14, 0.14, 0.14, 0.14, 0.15, 0.16, 0.16,
      0.16, 0.17, 0.17, 0.17, 0.17, 0.17, 0.18, 0.18, 0.18, 0.18, 0.18, 0.21,
      0.18, 0.22, 0.21, 0.21, 0.26, 0.26, 0.25, 0.25, 0.26, 0.26, 0.25, 0.25,
      0.24, 0.24, 0.29, 0.29, 0.29, 0.28, 0.27, 0.28, 0.28, 0.28, 0.28, 0.28,
      0.28, 0.28, 0.23, 0.2, 0.17, 0.17, 0.16, 0.16, 0.16, 0.16, 0.16, 0.16,
      0.16, 0.16, 0.16, 0.19, 0.19, 0.21,
    ],
    [
      0.01, 0.03, 0.04, 0.06, 0.07, 0.09, 0.11, 0.13, 0.16, 0.2, 0.25, 0.3,
      0.35, 0.43, 0.52, 0.64, 0.68, 0.83, 0.87, 1.1, 1.13, 1.18, 1.55, 1.58,
      1.63, 1.66, 1.71, 2.34, 2.36, 2.4, 2.43, 2.44, 2.46, 2.51, 2.53, 2.56,
      2.56, 2.6, 2.66, 2.68, 2.71, 2.75, 2.8, 2.83, 2.84, 2.86, 2.89, 2.92,
      2.95, 2.97, 3.03, 3.03, 3.05, 3.07, 3.08, 3.13, 3.17, 4.91, 4.97, 5.03,
      5.04, 5.1, 5.08, 5.16, 5.22, 5.25, 5.27, 5.35, 5.39, 5.44, 5.46, 5.46,
      5.54, 11.16, 5.57, 5.65, 5.71, 5.74, 5.8, 5.83, 5.89, 5.87, 5.92, 5.95,
      5.93, 5.99, 6.02, 6.01, 6.02, 6.05, 6.08, 6.09, 6.09, 6.08, 6.14, 6.15,
      6.11, 6.11, 6.11, 6.09, 6.11, 6.11, 6.12, 6.17, 6.17, 6.2, 6.2, 6.25,
      6.28, 6.31, 6.34, 6.36, 6.43, 6.42, 6.46, 6.52, 6.5, 6.52, 6.56, 6.53,
      6.53, 6.56, 6.56, 6.58, 6.61, 6.62, 6.65, 6.68, 6.69, 6.69, 6.72, 6.71,
      6.68, 6.71, 6.66, 6.66, 6.62, 6.65, 13.39, 13.44, 13.33, 13.33, 13.24,
      13.24, 13.27, 13.3, 13.27, 13.24, 13.24, 13.18, 13.18, 13.12, 13.12,
      13.12, 13.06, 6.44, 6.4, 6.42, 6.39, 6.34, 6.33, 6.3, 6.25, 6.23, 6.2,
      6.18, 6.15, 6.15, 6.15, 6.14, 6.15, 6.18, 6.21, 6.23, 6.25, 6.25, 6.27,
      6.25, 6.24, 6.25, 6.25, 6.24, 6.21, 6.24, 6.3, 6.3, 6.28, 6.3, 6.31, 6.31,
      6.33, 6.36, 6.37, 6.37, 6.42, 6.44, 6.47, 6.49, 6.52, 6.55, 6.58, 6.56,
      6.55, 6.55, 6.58, 6.59, 6.59, 13.42, 13.39, 13.42, 13.42, 13.36, 13.3,
      13.3, 13.27, 13.27, 13.27, 13.27, 13.27, 13.27, 13.27, 13.3, 13.24, 13.24,
      13.21, 13.21, 13.21, 6.52, 6.47, 6.44, 6.43, 6.37, 6.37, 6.33, 6.31, 6.3,
      6.25, 6.24, 6.23, 6.21, 6.23, 6.18, 6.18, 6.24, 6.25, 6.23, 6.2, 6.2, 6.2,
      6.23, 6.18, 6.2, 6.17, 6.21, 6.2, 6.21, 6.23, 6.24, 6.28, 6.28, 6.36,
      6.39, 6.43, 6.47, 6.49, 6.55, 6.55, 6.56, 6.61, 6.62, 6.62, 6.58, 6.59,
      6.59, 6.55, 6.56, 6.55, 6.53, 13.18, 13.18, 13.12, 13.06, 13.06, 13.06,
      13.06, 13.06, 13.03, 13.06, 13.09, 13.09, 13.06, 13.06, 13.03, 13.06,
      6.46, 6.44, 6.46, 6.47, 6.46, 6.47,
    ],
    [
      7.2, 0.08, 0.05, 0.08, 0.06, 0.07, 0.14, 0.1, 0.17, 0.4, 0.43, 0.43, 0.46,
      43.2, 45.6, 45.6, 48, 50.4, 50.4, 50.4, 50.4, 50.4, 50.4, 50.4, 50.4,
      50.4, 50.4, 50.4, 50.4, 50.4, 50.4, 50.4, 50.4, 50.4, 50.4, 50.4, 50.4,
      50.4, 50.4, 50.4, 50.4, 50.4, 50.4, 50.4, 50.4, 50.4, 0.61, 0.3, 0.14,
      0.16, 0.16, 0.18, 0.18, 0.24, 0.42, 0.9, 0.9, 0.93, 0.96, 0.99, 1.05,
      88.8, 91.2, 96, 96, 96, 98.4, 98.4, 98.4, 100.8, 103.2, 103.2, 103.2,
      103.2, 103.2, 103.2, 103.2, 103.2, 103.2, 103.2, 103.2, 103.2, 103.2,
      103.2, 103.2, 103.2, 103.2, 103.2, 103.2, 103.2, 103.2, 103.2, 103.2,
      1.25, 1.25, 1.19, 0.59, 1.11, 0.55, 1.02, 1.02, 0.93, 0.93, 74.4, 0.9, 72,
      0.87, 0.87, 0.87, 0.87, 0.43, 0.42, 0.4, 0.81, 0.4, 0.76, 0.73, 0.7, 55.2,
      52.8, 52.8, 52.8, 50.4, 50.4, 50.4, 50.4, 50.4, 50.4, 50.4, 50.4, 50.4,
      50.4, 50.4, 50.4, 50.4, 50.4, 0.61, 0.3, 0.21, 0.17, 0.17, 0.18, 0.25,
      0.43, 0.45, 0.45, 0.93, 0.96, 1.02, 1.02, 1.05, 93.6, 96, 98.4, 98.4,
      98.4, 100.8, 103.2, 103.2, 103.2, 103.2, 103.2, 103.2, 103.2, 103.2,
      103.2, 103.2, 103.2, 103.2, 103.2, 103.2, 103.2, 103.2, 103.2, 103.2,
      103.2, 103.2, 103.2, 103.2, 103.2, 103.2, 103.2, 103.2, 1.25, 1.25, 1.22,
      1.19, 1.14, 1.08, 1.05, 1.02, 79.2, 76.8, 76.8, 76.8, 76.8, 76.8, 76.8,
      76.8, 76.8, 76.8, 76.8, 76.8, 76.8, 76.8, 76.8, 76.8, 76.8, 76.8, 76.8,
      76.8, 76.8, 76.8, 76.8, 76.8, 76.8, 76.8, 76.8, 76.8, 76.8, 76.8, 76.8,
      76.8, 76.8, 76.8, 76.8, 76.8, 76.8, 0.93, 0.93, 0.93, 0.93, 0.93, 76.8,
      76.8, 76.8, 76.8, 76.8, 76.8, 76.8, 76.8, 76.8, 76.8, 76.8, 76.8, 76.8,
      76.8, 76.8, 76.8, 76.8, 76.8, 76.8, 76.8, 76.8, 76.8, 76.8, 76.8, 76.8,
      76.8, 76.8, 76.8, 76.8, 76.8, 76.8, 76.8, 76.8, 76.8, 76.8, 76.8, 76.8,
      76.8, 76.8, 76.8, 0.93, 0.93, 0.46, 0.43, 0.81, 0.79, 60, 57.6, 57.6,
      57.6, 55.2, 55.2, 55.2, 55.2, 55.2, 55.2, 55.2, 55.2, 55.2, 55.2, 55.2,
      55.2, 55.2, 55.2, 55.2, 55.2, 55.2,
    ],
    [
      9.6, 0.11, 0.05, 0.11, 0.05, 0.04, 0.06, 0.05, 0.04, 0.05, 0.06, 0.05,
      0.06, 0.06, 0.05, 0.06, 0.07, 0.07, 0.09, 0.09, 0.09, 0.1, 0.1, 0.1, 0.11,
      0.14, 0.14, 0.15, 0.15, 0.15, 0.16, 0.17, 0.17, 0.18, 0.21, 0.18, 0.22,
      0.23, 0.23, 0.24, 0.24, 0.24, 0.3, 0.3, 0.3, 0.31, 0.32, 0.31, 0.33, 0.33,
      0.27, 0.28, 0.28, 0.28, 0.3, 0.3, 0.36, 0.37, 0.37, 0.37, 0.37, 0.38,
      0.38, 0.39, 0.39, 0.38, 0.4, 0.4, 0.4, 0.41, 0.41, 0.4, 0.42, 0.42, 0.42,
      0.53, 0.43, 0.42, 0.56, 0.56, 0.55, 0.56, 0.56, 0.56, 0.56, 0.56, 0.58,
      0.58, 0.58, 0.8, 0.6, 0.6, 0.61, 0.61, 0.61, 0.62, 0.83, 0.84, 0.63, 0.63,
      0.63, 0.65, 0.65, 0.66, 0.9, 0.66, 0.67, 0.68, 0.67, 0.7, 0.69, 0.7, 0.95,
      0.94, 0.95, 0.96, 0.95, 0.96, 0.97, 0.98, 1, 1, 1.01, 1, 1, 1.02, 1.03,
      1.03, 1.05, 1.05, 1.05, 1.07, 1.06, 1.09, 1.1, 1.09, 1.1, 1.11, 1.1, 1.13,
      1.12, 1.13, 1.15, 1.7, 1.74, 1.15, 1.15, 1.17, 1.19, 1.21, 1.22, 1.21,
      1.23, 1.22, 1.21, 1.24, 1.25, 1.23, 1.25, 1.26, 1.26, 1.27, 1.3, 1.99,
      1.99, 1.97, 2.02, 1.97, 1.99, 2.02, 2.04, 2.06, 2.06, 2.07, 2.09, 2.1,
      2.16, 2.15, 2.13, 2.16, 2.16, 2.16, 2.18, 2.22, 2.25, 2.22, 2.25, 2.26,
      2.26, 2.26, 2.32, 2.32, 2.32, 2.32, 2.34, 2.34, 2.35, 2.39, 2.39, 2.39,
      2.41, 2.44, 2.41, 2.42, 2.44, 2.45, 2.41, 2.42, 2.42, 2.42, 2.44, 2.49,
      2.51, 2.49, 2.52, 2.51, 2.51, 5.12, 5.2, 5.2, 5.17, 5.23, 5.2, 5.17, 5.26,
      5.38, 5.38, 5.35, 5.44, 5.41, 5.38, 5.41, 5.44, 5.44, 5.5, 5.47, 5.44,
      5.47, 5.47, 5.44, 5.44, 5.5, 5.44, 5.44, 5.5, 5.47, 5.41, 5.44, 5.41,
      5.41, 5.41, 5.35, 5.35, 5.41, 5.38, 5.41, 5.44, 5.38, 5.35, 5.44, 5.44,
      5.41, 5.47, 5.44, 5.41, 5.47, 5.44, 5.44, 5.47, 5.5, 5.47, 5.5, 5.5, 5.47,
      5.47, 5.47, 5.47, 5.47, 5.47, 5.38, 5.41, 5.44, 5.41, 5.44, 5.38, 5.35,
      5.38, 5.44, 5.38, 5.38, 5.38, 5.32, 5.26, 5.32, 5.32, 5.32, 5.38, 5.38,
      5.32, 5.32,
    ],
    [
      7.2, 0.08, 0.04, 0.08, 0.05, 0.04, 0.05, 0.03, 0.03, 0.05, 0.05, 0.05,
      0.05, 0.07, 0.07, 0.08, 0.09, 0.09, 0.1, 0.11, 0.12, 0.13, 0.13, 0.13,
      0.15, 0.14, 0.15, 0.19, 0.19, 0.19, 0.2, 0.21, 0.22, 0.22, 0.22, 0.23,
      0.19, 0.19, 0.19, 0.19, 0.19, 0.19, 0.16, 0.16, 0.16, 0.16, 0.19, 0.19,
      0.19, 0.2, 0.2, 0.21, 0.2, 0.25, 0.26, 0.26, 0.25, 0.27, 0.28, 0.26, 0.27,
      0.37, 0.38, 0.39, 0.37, 0.38, 0.58, 0.38, 0.38, 0.41, 0.4, 0.4, 0.41,
      0.41, 0.42, 0.42, 0.41, 0.42, 0.43, 0.42, 0.42, 0.42, 0.44, 0.43, 0.43,
      0.45, 0.45, 0.46, 0.68, 0.69, 0.71, 0.72, 0.69, 0.71, 0.74, 0.72, 0.72,
      0.77, 0.51, 0.51, 0.52, 0.5, 0.5, 0.48, 0.48, 0.47, 0.48, 0.46, 0.46,
      0.45, 0.45, 0.44, 0.32, 0.31, 0.31, 0.32, 0.42, 0.42, 0.42, 0.41, 0.63,
      0.62, 0.62, 0.63, 0.63, 0.61, 0.63, 0.65, 0.43, 0.43, 0.44, 0.44, 0.44,
      0.43, 0.44, 0.45, 0.44, 0.42, 0.43, 0.44, 0.43, 0.44, 0.43, 0.44, 0.31,
      0.32, 0.31, 0.31, 0.31, 0.42, 0.62, 0.65, 0.61, 0.62, 0.62, 0.63, 0.63,
      0.42, 0.44, 0.46, 0.44, 0.43, 0.68, 0.68, 0.45, 0.66, 0.68, 0.69, 0.68,
      0.68, 0.66, 0.68, 0.66, 0.68, 0.68, 0.66, 1.34, 1.34, 1.31, 1.34, 1.34,
      1.34, 1.4, 1.43, 1.4, 1.37, 0.69, 0.69, 0.69, 0.71, 0.46, 0.45, 0.46,
      0.44, 0.44, 0.44, 0.43, 0.41, 0.41, 0.59, 0.4, 0.58, 0.56, 0.56, 0.58,
      0.56, 0.37, 0.56, 0.56, 0.56, 0.56, 0.56, 0.56, 0.55, 0.55, 0.55, 0.56,
      0.37, 0.37, 0.38, 0.38, 0.27, 0.27, 0.26, 0.27, 0.28, 0.26, 0.27, 0.27,
      0.22, 0.27, 0.27, 0.28, 0.28, 0.29, 0.24, 0.24, 0.3, 0.31, 0.41, 0.42,
      0.43, 0.42, 0.41, 0.42, 0.42, 0.43, 0.42, 0.43, 0.44, 0.42, 0.43, 0.43,
      0.43, 0.44, 0.44, 0.44, 0.45, 0.46, 0.45, 0.45, 0.46, 0.46, 0.69, 0.69,
      0.71, 0.69, 0.71, 0.69, 0.71, 0.72, 0.74, 1.46, 1.52, 0.74, 0.75, 0.75,
      0.75, 0.5, 0.51, 0.51, 0.51, 0.49, 0.47, 0.48, 0.48, 0.47, 0.47, 0.47,
      0.45, 0.45, 0.44, 0.43, 0.42, 0.41, 0.61, 0.58, 0.38, 0.55, 0.55,
    ],
  ];
  var allSeries = [
    {
      name: "安全距离",
      type: "line",
      smooth: true,
      data: ydata[0],
    },
    {
      name: "智能驾驶员",
      type: "line",
      smooth: true,
      data: ydata[1],
    },
    {
      name: "静态",
      type: "line",
      smooth: true,
      data: ydata[2],
    },
    {
      name: "动态",
      type: "line",
      smooth: true,
      data: ydata[3],
    },
    {
      name: "低强度",
      type: "line",
      smooth: true,
      data: ydata[4],
    },
    {
      name: "高强度",
      type: "line",
      smooth: true,
      data: ydata[5],
    },
    {
      name: "circle交叉口",
      type: "line",
      smooth: true,
      data: ydata[6],
    },
    {
      name: "cross交叉口",
      type: "line",
      smooth: true,
      data: ydata[7],
    },
    {
      name: "t交叉口",
      type: "line",
      smooth: true,
      data: ydata[8],
    },
  ];
  // 1. 实例化对象
  var myChart = echarts.init(document.querySelector(".line3 .chart"));
  // 2.指定配置
  var option = {
    // 通过这个color修改两条线的颜色
    color: [
      "#00f2f1",
      "#ed3f35",
      "#1089E7",
      "#F57474",
      "#56D0E3",
      "#F8B448",
      "#8B78F6",
    ],
    tooltip: {
      trigger: "axis",
    },
    legend: {
      // 如果series 对象有name 值，则 legend可以不用写data
      // 修改图例组件 文字颜色
      textStyle: {
        color: "#4c9bfd",
      },
      // 这个10% 必须加引号
      right: "10%",
    },
    grid: {
      top: "20%",
      left: "3%",
      right: "4%",
      bottom: "3%",
      show: true, // 显示边框
      borderColor: "#012f4a", // 边框颜色
      containLabel: true, // 包含刻度文字在内
    },

    xAxis: {
      type: "category",
      boundaryGap: false,
      data: [
        0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
        20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
        38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
        56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73,
        74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
        92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107,
        108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
        122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135,
        136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
        150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163,
        164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177,
        178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
        192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205,
        206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219,
        220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233,
        234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247,
        248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261,
        262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275,
        276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289,
        290, 291, 292, 293, 294, 295, 296, 297, 298, 299,
      ],
      axisTick: {
        show: false, // 去除刻度线
      },
      axisLabel: {
        color: "#4c9bfd", // 文本颜色
      },
      axisLine: {
        show: false, // 去除轴线
      },
    },
    yAxis: {
      type: "value",
      axisTick: {
        show: false, // 去除刻度线
      },
      axisLabel: {
        color: "#4c9bfd", // 文本颜色
      },
      axisLine: {
        show: false, // 去除轴线
      },
      splitLine: {
        lineStyle: {
          color: "#012f4a", // 分割线颜色
        },
      },
    },

    series: [],
  };

  // 3. 把配置给实例对象
  myChart.setOption(option);
  // 4. 让图表跟随屏幕自动的去适应
  window.addEventListener("resize", function () {
    myChart.resize();
  });

  // 5.点击切换效果
  $(".line3 h2").on("click", "a", function () {
    this.style.color = "#ff4d4d";
    option.series.length = 0;
    console.log(option.series);
    console.log($(this).index());
    // 点击 a 之后 根据当前a的索引号 找到对应的 yearData的相关对象
    // console.log(yearData[$(this).index()]);
    // var obj = yearData[$(this).index()];
    if ($(this).index() == 3) {
      option.series[0] = allSeries[$(this).index() * 2];
      option.series[1] = allSeries[$(this).index() * 2 + 1];
      option.series[2] = allSeries[$(this).index() * 2 + 2];
      console.log(option.series);

      // option.series.push(allSeries[$(this).index() * 2])
      // option.series.push(allSeries[$(this).index() * 2 + 1])
      // option.series.push(allSeries[$(this).index() * 2 + 2])
    } else {
      option.series[0] = allSeries[$(this).index() * 2];
      option.series[1] = allSeries[$(this).index() * 2 + 1];
      option.series[2] = allSeries[$(this).index() * 2 + 1];

      //   option.series.push(allSeries[$(this).index() * 2])
      //   option.series.push(allSeries[$(this).index() * 2 + 1])
      console.log(option.series);
    }
    // 需要重新渲染
    myChart.setOption(option);
  });
})();
